﻿// CSaveBmpDlg.cpp: 实现文件
//

#include "stdafx.h"
#include "CK103.h"
#include "CSaveBmpDlg.h"
#include "afxdialogex.h"
#include <vector>

std::vector<CString> strSrcType = {
	L"原始图",
	L"黑白图"
};

const std::vector<CString> strBmpType = {
	L"bmp",
	L"jpg",
	L"png"
};
// CSaveBmpDlg 对话框

IMPLEMENT_DYNAMIC(CSaveBmpDlg, CMyDialog)

CSaveBmpDlg::CSaveBmpDlg(CWnd* pParent /*=nullptr*/)
	: CMyDialog(IDD_SAVE_BMP_DLG, pParent)
	, m_nSrcType(0)
	, m_nBmpType(0)
{

}

CSaveBmpDlg::~CSaveBmpDlg()
{
}

void CSaveBmpDlg::DoDataExchange(CDataExchange* pDX)
{
	CMyDialog::DoDataExchange(pDX);
	DDX_CBIndex(pDX, IDC_CMB_SRC_TYPE, m_nSrcType);
	DDX_CBIndex(pDX, IDC_CMB_BMP_TYPE, m_nBmpType);
	DDX_Control(pDX, IDC_CMB_SRC_TYPE, m_cmbSrcType);
	DDX_Control(pDX, IDC_CMB_BMP_TYPE, m_cmbBmpType);
	DDX_Control(pDX, IDOK, m_btnOk);
}


BEGIN_MESSAGE_MAP(CSaveBmpDlg, CMyDialog)
	ON_BN_CLICKED(IDOK, &CSaveBmpDlg::OnBnClickedOk)
END_MESSAGE_MAP()


// CSaveBmpDlg 消息处理程序


BOOL CSaveBmpDlg::OnInitDialog()
{
	CMyDialog::OnInitDialog();

	strSrcType[0] = g_LoadString(L"MSG20");
	strSrcType[1] = g_LoadString(L"MSG21");

	for (size_t i = 0; i < strSrcType.size(); i++)
	{
		m_cmbSrcType.AddString(strSrcType[i]);
	}

	for (size_t i = 0; i < strBmpType.size(); i++)
	{
		m_cmbBmpType.AddString(strBmpType[i]);
	}

	if (m_nSrcType < 0 || m_nSrcType >= (int)strSrcType.size())
	{
		m_nSrcType = 0;
	}

	if (m_nBmpType < 0 || m_nBmpType >= (int)strBmpType.size())
	{
		m_nBmpType = 0;
	}

	this->SetDlgBkColor(RGB(51, 51, 51), RGB(255, 255, 255));
	this->SetDlgBorderColor(RGB(51, 51, 51), 2);
	this->SetStaticColor(RGB(0, 0, 0), RGB(255, 255, 255));

	UpdateData(FALSE);

	//设置对话框上控件的语言文字
	g_SetDialogStrings(this, IDD);

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}


void CSaveBmpDlg::OnBnClickedOk()
{
	UpdateData();
	CMyDialog::OnOK();
}
